package o;

import android.content.Context;
import com.huawei.secure.android.common.SecureSSLSocketFactory;
import com.huawei.secure.android.common.SecureX509TrustManager;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
import o.fuv.b;

public class bjd {
    private final fuv ˋ;
    private Context ˎ;
    private bji ˏ;
    private bjm ॱ;

    public static final class a {
        final List<fuo> ʻ = new ArrayList();
        X509TrustManager ʼ;
        Context ʽ;
        b ˊ;
        long ˋ;
        long ˎ;
        bjm ˏ;
        long ॱ;
        bji ॱॱ;
        SSLSocketFactory ᐝ;

        public a(Context context) {
            this.ʽ = context.getApplicationContext();
            this.ˏ = bjm.ˏ;
            this.ॱॱ = bji.ˏ;
            this.ˎ = 5000;
            this.ॱ = 5000;
            this.ˋ = 5000;
            ˎ();
        }

        public bjd ˋ() {
            return new bjd(this);
        }

        private void ˎ() {
            if (this.ʽ != null) {
                try {
                    this.ᐝ = SecureSSLSocketFactory.getInstance(this.ʽ);
                    this.ʼ = new SecureX509TrustManager(this.ʽ);
                } catch (IOException e) {
                    this.ˏ.ˋ("IOException:" + e.getMessage());
                } catch (NoSuchAlgorithmException e2) {
                    this.ˏ.ˋ("NoSuchAlgorithmException:" + e2.getMessage());
                } catch (CertificateException e3) {
                    this.ˏ.ˋ("CertificateException:" + e3.getMessage());
                } catch (KeyStoreException e4) {
                    this.ˏ.ˋ("KeyStoreException:" + e4.getMessage());
                } catch (IllegalAccessException e5) {
                    this.ˏ.ˋ("IllegalAccessException:" + e5.getMessage());
                } catch (KeyManagementException e6) {
                    this.ˏ.ˋ("KeyManagementException:" + e6.getMessage());
                }
            }
        }

        public a ˎ(int i) {
            this.ʻ.add(new bjj(i));
            return this;
        }
    }

    bjd(a aVar) {
        b bVar;
        if (aVar.ˊ == null) {
            b bVar2 = new b();
            if (!(aVar.ᐝ == null || aVar.ʼ == null)) {
                bVar2.ॱ(aVar.ᐝ, aVar.ʼ);
            }
            bVar2.ˎ(aVar.ˎ, TimeUnit.MILLISECONDS);
            bVar2.ˊ(aVar.ॱ, TimeUnit.MILLISECONDS);
            bVar2.ˋ(aVar.ˋ, TimeUnit.MILLISECONDS);
            if (aVar.ʻ.isEmpty()) {
                bVar = bVar2;
            } else {
                for (fuo ˎ : aVar.ʻ) {
                    bVar2.ˎ(ˎ);
                }
                bVar = bVar2;
            }
        } else {
            bVar = aVar.ˊ;
        }
        this.ˎ = aVar.ʽ;
        this.ॱ = aVar.ˏ;
        this.ˏ = aVar.ॱॱ;
        bjs.ˋ(this.ॱ);
        bjs.ˋ(this.ˏ);
        this.ˋ = bVar.ˋ();
    }

    public <T extends bje> void ॱ(bjh o_bjh, bjf<T> o_bjf_T) {
        if (o_bjh.ˋ() == 0) {
            bjs.ˏ(this.ˎ, this.ˋ, (biz) o_bjh, o_bjf_T);
        } else if (o_bjh.ˋ() == 1) {
            bjp.ˎ(this.ˎ, this.ˋ, (bjb) o_bjh, o_bjf_T);
        } else if (o_bjh.ˋ() == 2) {
            bjw.ˏ(this.ˎ, this.ˋ, (bjl) o_bjh, o_bjf_T);
        } else {
            this.ॱ.ˋ("unhandle type: " + o_bjh.ˋ());
        }
    }
}
